package com.shensi.api.admin.client.system;

import com.shensi.api.admin.client.fallback.system.SysDicDataClientFallBack;
import com.shensi.common.core.constant.CloudConstant;
import com.shensi.common.core.domain.AjaxResult;
import com.shensi.common.core.domain.entity.SysDictData;
import com.shensi.common.core.page.TableDataInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author: budian
 * @since: 2023/11/30
 */
@FeignClient(
        value = CloudConstant.ADMIN_SERVER,
        fallbackFactory = SysDicDataClientFallBack.class)
@Component
public interface SysDicDataClient {

    @GetMapping("/list")
    public TableDataInfo list(@SpringQueryMap SysDictData dictData);

    @GetMapping("/export")
    public AjaxResult export(@SpringQueryMap SysDictData dictData);

    /**
     * 查询字典数据详细
     */
    @GetMapping(value = "/{dictCode}")
    public AjaxResult getInfo(@PathVariable("dictCode") Long dictCode);

    /**
     * 根据字典类型查询字典数据信息
     */
    @GetMapping(value = "/type/{dictType}")
    public AjaxResult dictType(@PathVariable("dictType") String dictType);

    /**
     * 新增字典类型
     */
    @PostMapping
    public AjaxResult add(@RequestBody SysDictData dict);

    /**
     * 修改保存字典类型
     */
    @PutMapping
    public AjaxResult edit(@RequestBody SysDictData dict);

    /**
     * 删除字典类型
     */
    @DeleteMapping("/{dictCodes}")
    public AjaxResult remove(@PathVariable("dictCodes") Long[] dictCodes);
}
